<h2 style="margin: 10px;">{{id==null ? '添加':'修改'}}{{type}}</h2>
<form nz-form [formGroup]="validateForm" (ngSubmit)="_submitForm()" style="margin-top: 10px;">
  <div nz-form-item nz-row>
    <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
      <label for="question" nz-form-item-required>问题</label>
    </div>
    <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback [nzValidateStatus]="getFormControl('question')">
      <nz-input [nzSize]="'large'" [nzType]="'textarea'" [nzRows]="'4'" formControlName="question" [nzId]="'question'"></nz-input>
      <div nz-form-explain *ngIf="getFormControl('question').dirty&&getFormControl('question').hasError('required')">问题不能空</div>
    </div>
  </div>
  <div *ngIf="type!='单选' && type!='编程'" nz-form-item nz-row>
    <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
      <label for="count" >题目数量</label>
    </div>
    <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
      <nz-input [nzSize]="'large'" formControlName="count" [nzId]="'count'"></nz-input>
    </div>
  </div>
  <div *ngIf="type=='编程'" nz-form-item nz-row>
    <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
      <label for="answer" nz-form-item-required>答案</label>
    </div>
    <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback [nzValidateStatus]="getFormControl('answer')">
      <nz-input [nzSize]="'large'" [nzType]="'textarea'" [nzRows]="'4'" formControlName="answer" [nzId]="'answer'"></nz-input>
      <div nz-form-explain *ngIf="getFormControl('answer').dirty&&getFormControl('answer').hasError('required')">答案不能空</div>
    </div>
  </div>
  <ng-template [ngIf]="type=='多选'||type=='填空'">
    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
        <label for="answerA" nz-form-item-required>答案a</label>
      </div>
      <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
        <nz-input [nzSize]="'large'" formControlName="answerA" [nzId]="'answerA'"></nz-input>
      </div>
    </div>
    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
        <label for="answerB" >答案b</label>
      </div>
      <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
        <nz-input [nzSize]="'large'" formControlName="answerB" [nzId]="'answerB'"></nz-input>
      </div>
    </div>
    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
        <label for="answerC" >答案c</label>
      </div>
      <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
        <nz-input [nzSize]="'large'" formControlName="answerC" [nzId]="'answerC'"></nz-input>
      </div>
    </div>
    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
        <label for="answerD" >答案d</label>
      </div>
      <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
        <nz-input [nzSize]="'large'" formControlName="answerD" [nzId]="'answerD'"></nz-input>
      </div>
    </div>

  </ng-template>
  <div *ngIf="type=='单选'" nz-form-item nz-row>
    <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
      <label for="answer" nz-form-item-required>答案</label>
    </div>
    <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
      <nz-input [nzSize]="'large'" formControlName="answer" [nzId]="'answer'"></nz-input>
    </div>
  </div>
  <ng-template [ngIf]="type=='单选' || type=='多选'">
    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
        <label for="optionA" nz-form-item-required>选项A</label>
      </div>
      <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
        <nz-input [nzSize]="'large'" formControlName="optionA" [nzId]="'optionA'"></nz-input>
      </div>
    </div>
    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
        <label for="optionB" nz-form-item-required>选项B</label>
      </div>
      <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
        <nz-input [nzSize]="'large'" formControlName="optionB" [nzId]="'optionB'"></nz-input>
      </div>
    </div>
    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
        <label for="optionC" nz-form-item-required>选项C</label>
      </div>
      <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
        <nz-input [nzSize]="'large'" formControlName="optionC" [nzId]="'optionC'"></nz-input>
      </div>
    </div>
    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
        <label for="optionD" nz-form-item-required>选项D</label>
      </div>
      <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
        <nz-input [nzSize]="'large'" formControlName="optionD" [nzId]="'optionD'"></nz-input>
      </div>
    </div>
  </ng-template>
  <div nz-form-item nz-row>
    <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
      <label for="grade">分数</label>
    </div>
    <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
        <nz-input [nzSize]="'large'" formControlName="grade" [nzId]="'grade'"></nz-input>
    </div>
  </div>
  <div nz-form-item nz-row>
    <div nz-form-label nz-col [nzSm]="6" [nzXs]="24">
      <label for="note" >备注</label>
    </div>
    <div nz-form-control nz-col [nzSm]="14" [nzXs]="24" nzHasFeedback>
      <nz-input [nzSize]="'large'" [nzType]="'textarea'" [nzRows]="'4'" formControlName="note" [nzId]="'note'"></nz-input>
    </div>
  </div>

  <div nz-form-item nz-row style="margin-bottom:8px;">
    <div nz-form-control nz-col [nzSpan]="14" [nzOffset]="6">
      <button nz-button [nzSize]="'large'" [nzType]="'primary'">保存</button>
    </div>
  </div>
</form>